package com.flyemu.share.entity;

import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.CreationTimestamp;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
 * @功能描述: 组织机构实体类
 * @创建时间: 2023年08月08日
 * @公司官网: www.fenxi365.com
 * @公司信息: 纷析云（杭州）科技有限公司
 * @公司介绍: 专注于财务相关软件开发, 企业会计自动化解决方案
 */
@Getter
@Setter
@Entity
@NoArgsConstructor
@Table(uniqueConstraints = {@UniqueConstraint(columnNames = {"code", "merchantId"})})
public class Organization implements Serializable {
    private static final long serialVersionUID = -24843859909377092L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @Comment("编码")
    @Column(length = 32, nullable = false)
    private String code;

    @Comment("名称")
    @Column(length = 64, nullable = false)
    private String name;

    @Comment("组织类型")
    private Integer type;

    @Comment("地址")
    private String address;

    @Comment("联系人")
    private String linkman;

    @Comment("邮箱")
    private String email;

    @Comment("联系电话")
    private String phone;

    @Comment("创建时间")
    @CreationTimestamp
    @Column(updatable = false)
    private LocalDateTime createDate;

    @Comment("是否启用")
    private Boolean enabled;

    @Comment("父id")
    private Integer parentId;


    @Column(nullable = false)
    private Integer merchantId;

    public Organization(Integer id) {
        this.id = id;
    }

    public Organization(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Organization(Integer id, String name, String code) {
        this.id = id;
        this.name = name;
        this.code = code;

    }
}

